/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Frmcuenta_bancaria.java
 *
 * Created on 29/05/2011, 13:47:37
 */

package logano;

import loganosystem.contrato.Cuenta_bancaria;
import util.Helper;

/**
 *
 * @author loreh
 */
public class Frmcuenta_bancaria extends FrmBaseEdicion {

    Cuenta_bancaria cuentab = new Cuenta_bancaria();
    /** Creates new form Frmcuenta_bancaria */
    public Frmcuenta_bancaria() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        txtnºcuenta = new javax.swing.JLabel();
        txtsaldo = new javax.swing.JLabel();
        tbncuenta = new javax.swing.JTextField();
        tbsaldo = new javax.swing.JTextField();
        btaceptar = new javax.swing.JButton();
        btlimpiar = new javax.swing.JButton();
        btcancelar = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setName("Form"); // NOI18N

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(logano.LoganoApp.class).getContext().getResourceMap(Frmcuenta_bancaria.class);
        txtnºcuenta.setText(resourceMap.getString("txtnºcuenta.text")); // NOI18N
        txtnºcuenta.setName("txtnºcuenta"); // NOI18N

        txtsaldo.setText(resourceMap.getString("txtsaldo.text")); // NOI18N
        txtsaldo.setName("txtsaldo"); // NOI18N

        tbncuenta.setText(resourceMap.getString("tbncuenta.text")); // NOI18N
        tbncuenta.setName("tbncuenta"); // NOI18N
        tbncuenta.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                tbncuentaKeyPressed(evt);
            }
        });

        tbsaldo.setText(resourceMap.getString("tbsaldo.text")); // NOI18N
        tbsaldo.setName("tbsaldo"); // NOI18N
        tbsaldo.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                tbsaldoKeyPressed(evt);
            }
        });

        btaceptar.setText(resourceMap.getString("btaceptar.text")); // NOI18N
        btaceptar.setName("btaceptar"); // NOI18N
        btaceptar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btaceptarActionPerformed(evt);
            }
        });

        btlimpiar.setText(resourceMap.getString("btlimpiar.text")); // NOI18N
        btlimpiar.setName("btlimpiar"); // NOI18N
        btlimpiar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btlimpiarActionPerformed(evt);
            }
        });

        btcancelar.setText(resourceMap.getString("btcancelar.text")); // NOI18N
        btcancelar.setName("btcancelar"); // NOI18N
        btcancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btcancelarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(23, 23, 23)
                .addComponent(txtnºcuenta)
                .addGap(2, 2, 2)
                .addComponent(tbncuenta, javax.swing.GroupLayout.DEFAULT_SIZE, 116, Short.MAX_VALUE)
                .addGap(192, 192, 192))
            .addGroup(layout.createSequentialGroup()
                .addGap(33, 33, 33)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(btaceptar)
                        .addGap(18, 18, 18)
                        .addComponent(btlimpiar, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(btcancelar)
                        .addGap(124, 124, 124))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(txtsaldo, javax.swing.GroupLayout.DEFAULT_SIZE, 49, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(tbsaldo, javax.swing.GroupLayout.DEFAULT_SIZE, 116, Short.MAX_VALUE)
                        .addGap(190, 190, 190))))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(47, 47, 47)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtnºcuenta)
                    .addComponent(tbncuenta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtsaldo)
                    .addComponent(tbsaldo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 53, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btaceptar)
                    .addComponent(btlimpiar)
                    .addComponent(btcancelar))
                .addGap(96, 96, 96))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btaceptarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btaceptarActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_btaceptarActionPerformed

    private void btlimpiarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btlimpiarActionPerformed

        txtnºcuenta.setText("");
        txtsaldo.setText("");
    }//GEN-LAST:event_btlimpiarActionPerformed

    @Override
    protected Cuenta_bancaria getValues()
    {
       this.cuentab.setNro_cuenta(tbncuenta.getText());
       this.cuentab.setSaldo(tbsaldo.getText());
       return this.cuentab;

    }

    @Override
    protected void setValues()
    {
        this.tbncuenta.setText(String.valueOf(this.cuentab.getNro_cuenta()));
        this.tbsaldo.setText(String.valueOf(this.cuentab.getSaldo()));
       
    }




    private void btcancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btcancelarActionPerformed

        dispose();
        // TODO add your handling code here:
    }//GEN-LAST:event_btcancelarActionPerformed

    private void tbncuentaKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_tbncuentaKeyPressed
         Helper.enterKeyPressed(evt, tbsaldo);
    }//GEN-LAST:event_tbncuentaKeyPressed

    private void tbsaldoKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_tbsaldoKeyPressed
         Helper.enterKeyPressed(evt, tbncuenta);
    }//GEN-LAST:event_tbsaldoKeyPressed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Frmcuenta_bancaria().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btaceptar;
    private javax.swing.JButton btcancelar;
    private javax.swing.JButton btlimpiar;
    private javax.swing.JTextField tbncuenta;
    private javax.swing.JTextField tbsaldo;
    private javax.swing.JLabel txtnºcuenta;
    private javax.swing.JLabel txtsaldo;
    // End of variables declaration//GEN-END:variables

}
